package moodish.comm;

import java.io.Serializable;

/**
 * Message Sended From the client to the server
 * 
 * Implements ServerSideMessage, Serializable
 */
public class MessageToServer implements ServerSideMessage, Serializable {
	private static final long serialVersionUID = -1630221989354100546L;
	
	// ServerSideMessage.Type
	private Type type;
	
	// Nickname & Payload
	private String nickname;
	private String payload;
	

	/**
	 * Message Construtor
	 * 
	 * @param nickname from the client
	 * @param payload used for some specific messages
	 * @param type message Type
	 */
	public MessageToServer(String nickname, String payload, ServerSideMessage.Type type) {
		this.nickname = nickname;
		this.payload = payload;
		this.type = type;
	}

	
	/**
	 * Get the message Type
	 * 
	 * @return ServerSideMessage type
	 */
	@Override
	public Type getType() {
		return type;
	}

	/**
	 * Get the message Sender nickname
	 * 
	 * @return String sender
	 */
	@Override
	public String getClientNickname() {
		return nickname;
	}
	
	/**
	 * Get the message payload
	 * 
	 * @return String payload
	 */
	@Override
	public String getPayload() {
		return payload;
	}

}
